<template>
  <div class="f-loading__mask" v-show="show">
    <div class='mb-20px f-loading__icon'></div>
    <p>加载中 . . .</p>
  </div>
</template>

<script setup lang="ts">
const props = defineProps({
  show: {
    type: Boolean,
    default: false
  }
})
</script>

<style lang="less" scoped>
.f-loading {
  &__mask {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1011;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #000;
    opacity: 0.7;
    color: rgb(25, 137, 250);
  }

  &__icon {
    width: 30px;
    height: 30px;
    background-color: rgb(25, 137, 250);
    // 使用厂商前缀 -webkit 或是-ms- 用于不支持 animation 和 transform 属性的浏览器
    -webkit-animation: rotateplane 1.2s infinite ease-in-out;
    animation: rotateplane 1.2s infinite ease-in-out;
  }

  @-webkit-keyframes rotateplane {
    0% {
      -webkit-transform: perspective(120px)
    }

    50% {
      -webkit-transform: perspective(120px) rotateY(180deg)
    }

    100% {
      -webkit-transform: perspective(120px) rotateY(180deg) rotateX(180deg)
    }
  }

  @keyframes rotateplane {
    0% {
      transform: perspective(120px) rotateX(0deg) rotateY(0deg);
      -webkit-transform: perspective(120px) rotateX(0deg) rotateY(0deg)
    }

    50% {
      transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg);
      -webkit-transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg)
    }

    100% {
      transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);
      -webkit-transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);
    }
  }
}
</style>
